<?php
  require(dirname(__FILE__).'/global.php');   
  require(ROOT.'/admin/isLogin.php');
  
  $submit = $_POST['submit'];
  if(!isset($submit)){
      $sql = "select * from talking_post where PostType IS NOT NULL AND PostType = 0";
      $posts = $db->query($sql);
      $smarty->assign('posts',$posts);
      $smarty->display('post_approve.html');
  }
  else{
      $dels = $_POST['del'];
      foreach($dels as $del){
          $sql = $db->getSql('delete_posts');
          $sql = $db->setParam('postid',$del,$sql);
          $db->execute($sql);
      }       
      echo "<script>location.href='./post.php';</script>";
  }
?>
